namespace Sundry.DAL.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class UpdateLoginLog : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.AdminLoginLogs",
                c => new
                    {
                        AdminLoginLogId = c.Int(nullable: false, identity: true),
                        AdminLoginAddress = c.String(maxLength: 100),
                        AdminLoginIP = c.String(maxLength: 50),
                        AdminLoginTime = c.DateTime(nullable: false),
                        AdminLoginBrowser = c.String(),
                        AdminId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.AdminLoginLogId)
                .ForeignKey("dbo.Admins", t => t.AdminId, cascadeDelete: true)
                .Index(t => t.AdminId);
            
            CreateTable(
                "dbo.Admins",
                c => new
                    {
                        AdminId = c.Int(nullable: false, identity: true),
                        AdminNickName = c.String(maxLength: 10),
                        AdminUserName = c.String(maxLength: 20),
                        AdminPassword = c.String(maxLength: 200),
                        AdminSalt = c.String(maxLength: 10),
                        AuthoryId = c.Int(nullable: false),
                        AdminCreateTime = c.DateTime(nullable: false),
                        AdminLastLoginIP = c.String(maxLength: 50),
                        AdminLastLoginTime = c.DateTime(nullable: false),
                        AdminLastLoginAddress = c.String(maxLength: 100),
                    })
                .PrimaryKey(t => t.AdminId);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.AdminLoginLogs", "AdminId", "dbo.Admins");
            DropIndex("dbo.AdminLoginLogs", new[] { "AdminId" });
            DropTable("dbo.Admins");
            DropTable("dbo.AdminLoginLogs");
        }
    }
}
